package com.cn.xiongmeng.czlxz.utils;

import android.content.Context;
import android.content.SharedPreferences;

public class DeviceStateChecker {
    public static boolean checkDeviceState(Context context){
        SharedPreferences prefs = context.getSharedPreferences("AppPrefs", Context.MODE_PRIVATE);

        String key = "deviceStateStorage";

        boolean deviceStateStorage = prefs.getBoolean(key, true);

        return deviceStateStorage;
    }
    public static void setDeviceState(Context context, boolean deviceStateStorage){
        SharedPreferences prefs = context.getSharedPreferences("AppPrefs", Context.MODE_PRIVATE);

        String key1 = "deviceStateStorage";
        String key2 = "preSetDeviceState";
        long curDate = System.currentTimeMillis();

        SharedPreferences.Editor editor = prefs.edit();
        editor.putBoolean(key1, deviceStateStorage);
        editor.putLong(key2, curDate);
        editor.apply();
    }
}
